﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.master" CodeBehind="Default.aspx.cs"
    Inherits="ASPNETPerformance._01_ViewState.Default" %>

<%@ Register Src="~/UserControls/SideMenu.ascx" TagName="SideMenu" TagPrefix="ws" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h2>
        ViewState 性能优化示例</h2>
    <ws:SideMenu runat="server" ID="sm" />
    <div class="grid">
        <div class="rounded">
            <div class="top-outer">
                <div class="top-inner">
                    <div class="top">
                        <h2>
                            Northwind Products
                            <asp:Button Text="回传" ID="Button1" runat="server" /></h2>
                    </div>
                </div>
            </div>
            <div class="mid-outer">
                <div class="mid-inner">
                    <div class="mid">
                        <!-- Content Goes Here! -->
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="datatable"
                            AllowPaging="true" AllowSorting="true" CellPadding="0" CellSpacing="0" BorderWidth="0"
                            GridLines="None" SortedAscendingHeaderStyle-CssClass="sortasc" SortedDescendingHeaderStyle-CssClass="sortdesc"
                            SortedAscendingCellStyle-CssClass="sortasc" SortedDescendingCellStyle-CssClass="sortdesc">
                            <PagerStyle CssClass="pager-row" />
                            <RowStyle CssClass="row" />
                            <PagerSettings Mode="NumericFirstLast" PageButtonCount="7" FirstPageText="«" LastPageText="»" />
                            <Columns>
                                <asp:BoundField DataField="ProductName" HeaderText="Product" SortExpression="ProductName" />
                                <asp:BoundField DataField="CategoryName" HeaderText="Category" SortExpression="CategoryName" />
                                <asp:BoundField DataField="CompanyName" HeaderText="Supplier" SortExpression="CompanyName" />
                                <asp:BoundField DataField="QuantityPerUnit" HeaderText="Qty/Unit" SortExpression="QuantityPerUnit" />
                                <asp:BoundField DataField="UnitPrice" DataFormatString="{0:c}" HeaderText="Price"
                                    SortExpression="UnitPrice"></asp:BoundField>
                                <asp:CheckBoxField DataField="Discontinued" HeaderText="Discontinued" SortExpression="Discontinued">
                                </asp:CheckBoxField>
                            </Columns>
                        </asp:GridView>
                        <asp:SqlDataSource ID="dsProducts" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                            SelectCommand="SELECT Products.ProductName, Categories.CategoryName, Suppliers.CompanyName, Products.QuantityPerUnit, Products.UnitPrice, Products.Discontinued FROM Products INNER JOIN Categories ON Products.CategoryID = Categories.CategoryID INNER JOIN Suppliers ON Products.SupplierID = Suppliers.SupplierID ORDER BY Products.ProductName">
                        </asp:SqlDataSource>
                    </div>
                </div>
            </div>
            <div class="bottom-outer">
                <div class="bottom-inner">
                    <div class="bottom">
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
